/* Modern sidebar and viewport styling */

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #181c24 0%, #232a36 100%);
    color: #232a36;
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    background: linear-gradient(135deg, #283e51 0%, #485563 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    border-right: 1px solid rgba(255,255,255,0.07);
    position: relative;
    z-index: 10;
    overflow: hidden;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 30px 18px 0 18px; /* 30px top margin, 18px left/right, 0px bottom */
    flex: 1 1 auto;
    box-sizing: border-box;
}

.sidebar-group .sidebar-btn:first-child {
    margin-top: 12px; /* Adds extra space above the first button */
}

.sidebar-bottom {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 0;
    margin-top: auto;
}

.settings-btn {
    background: none;
    border: none;
    color: #bdc3c7;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90%;
    box-sizing: border-box;
    margin: 0 auto;
}

.settings-btn:hover {
    color: #3498db;
    background: rgba(52,152,219,0.10);
}

.sidebar-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-btn.active,
.sidebar-btn:hover {
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(52,152,219,0.12);
}

.sidebar-btn.active::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: #3498db;
    border-radius: 2px;
}

.main-content {
    flex: 1;
    padding: 40px 32px;
    background: linear-gradient(135deg, #f5f6fa 0%, #ececec 100%);
    min-height: 100vh;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 32px rgba(44,62,80,0.08) inset;
    overflow: auto;
}

.main-content h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 28px;
    color: #3498db;
    letter-spacing: 1px;
    text-shadow: 0 2px 12px rgba(52,152,219,0.08);
}

/* Accounting Method Filter Section */
.accounting-filter-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(44,62,80,0.06);
    border-left: 4px solid #3498db;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.accounting-method-toggle {
    display: flex;
    background: #ecf0f1;
    border-radius: 8px;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.method-option {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.method-option.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(52,152,219,0.25);
}

.method-option:hover:not(.active) {
    background: rgba(52,152,219,0.1);
    color: #3498db;
}

.filter-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #7f8c8d;
    font-size: 14px;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

/* Method-specific table styling */
.cash-basis-mode .amount-cell {
    position: relative;
}

.cash-basis-mode .amount-cell::after {
    content: '💰';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.6;
}

.progress-basis-mode .project-name-link {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.05) 0%, rgba(39, 174, 96, 0.1) 100%);
    border-color: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.progress-basis-mode .project-name-link:hover {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-color: #229954;
    color: white;
}

/* Status indicators for different accounting methods */
.accounting-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-completed {
    background: #27ae60;
    color: white;
}

.status-in-progress {
    background: #f39c12;
    color: white;
}

.status-invoiced {
    background: #3498db;
    color: white;
}

.status-paid {
    background: #2ecc71;
    color: white;
}

.status-pending {
    background: #e74c3c;
    color: white;
}

/* Progress bar for percentage completion */
.progress-container {
    width: 80px;
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Cash flow indicators */
.cash-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #7f8c8d;
}

.cash-indicator .icon {
    font-size: 14px;
}

.cash-in {
    color: #27ae60;
}

.cash-out {
    color: #e74c3c;
}

.cash-pending {
    color: #f39c12;
}

/* Professional finance-style table styling */
.job-ledger-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    box-shadow: 0 2px 16px rgba(44,62,80,0.08);
    border-radius: 12px;
    overflow: hidden;
    margin: 32px 0;
    font-family: 'Inter', Arial, sans-serif;
}

.job-ledger-table thead tr {
    background: #232a36;
    color: #fff;
}

.job-ledger-table th, .job-ledger-table td {
    padding: 16px 12px;
    text-align: left;
    font-size: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.job-ledger-table th {
    font-weight: 700;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #3498db;
}

.job-ledger-table tbody tr {
    transition: background 0.2s;
}

.job-ledger-table tbody tr:hover {
    background: #f4f8fb;
}

.job-ledger-table td {
    color: #232a36;
    vertical-align: middle;
}

.job-ledger-table tbody tr:last-child td {
    border-bottom: none;
}

/* Professional project name link styling */
.project-name-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(52, 152, 219, 0.1) 100%);
    border: 1px solid rgba(52, 152, 219, 0.2);
    min-width: 120px;
    text-align: center;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.project-name-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.project-name-link:hover {
    color: #fff;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
    transform: translateY(-1px);
}

.project-name-link:hover::before {
    left: 100%;
}

.project-name-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

/* Focus state for accessibility */
.project-name-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Responsive for smaller screens */
@media (max-width: 900px) {
    .sidebar {
        width: 70px;
        padding-top: 16px;
    }
    .sidebar-group {
        padding: 0 4px;
    }
    .sidebar-btn {
        font-size: 0;
        padding: 12px 6px;
    }
    .sidebar-btn.active::before {
        left: 0;
    }
    .main-content {
        padding: 18px 4px;
    }
    .main-content h1 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    .job-ledger-table, .job-ledger-table thead, .job-ledger-table tbody, .job-ledger-table th, .job-ledger-table td, .job-ledger-table tr {
        display: block;
    }
    .job-ledger-table thead {
        display: none;
    }
    .job-ledger-table tr {
        margin-bottom: 16px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(44,62,80,0.06);
    }
    .job-ledger-table td {
        padding: 12px;
        border: none;
        position: relative;
    }
    .job-ledger-table td:before {
        content: attr(data-label);
        font-weight: 700;
        color: #3498db;
        display: block;
        margin-bottom: 4px;
    }
}

/* Add subtle hover effect for sidebar */
.sidebar-btn:not(.active):hover {
    background: rgba(52,152,219,0.06);
}

/* Sub-item styling for nested sidebar buttons */
.sidebar-btn.sub-item {
    margin-left: 20px;
    padding-left: 24px;
    font-size: 14px;
    opacity: 0.8;
    border-left: 2px solid rgba(52, 152, 219, 0.3);
    position: relative;
}

.sidebar-btn.sub-item:before {
    content: '└';
    position: absolute;
    left: 8px;
    color: rgba(52, 152, 219, 0.5);
    font-size: 12px;
}

.sidebar-btn.sub-item:hover {
    opacity: 1;
    border-left-color: rgba(52, 152, 219, 0.6);
}

.sidebar-btn.sub-item.active {
    border-left-color: #3498db;
}

/* Tab Navigation Styles */
.tab-navigation {
    margin: 20px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.main-tabs {
    display: flex;
    gap: 0;
}

.main-tab {
    background: none;
    border: none;
    color: #bdc3c7;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.main-tab:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.main-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

/* Tab Content Styles */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sub-tab Navigation */
.sub-tab-navigation {
    margin: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sub-tab {
    background: none;
    border: none;
    color: #95a5a6;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-right: 8px;
}

.sub-tab:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.sub-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

/* Sub-tab Content */
.sub-tab-content {
    display: none;
    padding: 20px 0;
}

.sub-tab-content.active {
    display: block;
}

/* Modals Section Styles */
.modals-section h2 {
    color: #ecf0f1;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

.modals-section p {
    color: #bdc3c7;
    margin-bottom: 24px;
}

.modals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.modal-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.3);
}

.modal-item h3 {
    color: #ecf0f1;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-item p {
    color: #95a5a6;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.modal-item .btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-item .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.modal-item .btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.modal-item.add-new {
    border: 2px dashed rgba(52, 152, 219, 0.3);
    background: rgba(52, 152, 219, 0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

.modal-item.add-new:hover {
    border-color: rgba(52, 152, 219, 0.5);
    background: rgba(52, 152, 219, 0.1);
}

.modal-item.add-new h3 {
    color: #3498db;
    justify-content: center;
}

.modal-item.add-new .fas {
    font-size: 16px;
}